﻿<src:PMFDataControl xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" 
    x:Class="SmartSpace.UI.Silverlight.Dynamic.Controls.AttachmentControl"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:src="clr-namespace:SmartSpace.UI.Silverlight.Dynamic.Controls"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
    
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Border Name="m_stackBar" Grid.Row="0" BorderThickness="1,1,1,0">
            <StackPanel Orientation="Horizontal">
                <Button Name="m_buttonBrowse" Grid.Column="1" Height="23" Click="m_buttonBrowse_Click">
                    <StackPanel Orientation="Horizontal">
                        <Image Source="../Resources/open.png" Margin="0,0,4,0"/>
                        <TextBlock Text="浏览" VerticalAlignment="Center"/>
                    </StackPanel>
                </Button>
            </StackPanel>
        </Border>
        <Border BorderThickness="1" Grid.Row="1">
            <sdk:DataGrid x:Name="m_datagrid" BorderThickness="0" MinHeight="100" MaxHeight="400" AutoGenerateColumns="False" IsReadOnly="True">
                <sdk:DataGrid.Columns>
                    <!--文件名-->
                    <sdk:DataGridTemplateColumn Header="文件名" Width="*">
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <HyperlinkButton Content="{Binding Path=FileName}" Click="OnHyperlinkButtonDownloadClick" />
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>
                    <!--保存是否成功-->
                    <sdk:DataGridCheckBoxColumn IsReadOnly="True" Header="已上传" Width="Auto" Binding="{Binding Path=IsUploaded}" />
                    <!--删除按钮-->
                    <sdk:DataGridTemplateColumn Header="操作" Width="auto">
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <HyperlinkButton Name="m_buttonDelete" Grid.Column="1" VerticalAlignment="Center" VerticalContentAlignment="Center" Click="m_buttonDelete_Click">
                                    <StackPanel Orientation="Horizontal">
                                        <Image Source="../../Resources/Delete.png" Margin="0,0,4,0"/>
                                        <TextBlock Text="删除" VerticalAlignment="Center" Margin="0"/>
                                    </StackPanel>
                                </HyperlinkButton>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>
                </sdk:DataGrid.Columns>
            </sdk:DataGrid>
        </Border>
    </Grid>
</src:PMFDataControl>
